package file_cleaner

import (
	"file-cleaner/internal/file_cleaner/config"
)

func Run(cfg *config.Config) error {
	l, err := createLogger(cfg)
	if err != nil {
		return err
	}

	err = l.Init()
	if err != nil {
		return err
	}
	defer l.Flush()

	server, err := createServer(cfg)
	if err != nil {
		return err
	}
	return server.PrepareRun().Run()
}
